package com.itjob.scott.util;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class CookieUtil {

	public static Cookie getCookie(HttpServletRequest request,String name){
		Cookie c = null;
		System.out.println(request.getCookies().length);
		
		for (Cookie cookie: request.getCookies()) {
			System.out.println("Cookie Key="+cookie.getName()+",Cookie Value="+cookie.getValue());
			if(cookie.getName().equals(name)){
				c=cookie;
			}
		}
		return c;
		
	} 
}
